package cn.zptc.springbootdemo.service;

import cn.zptc.springbootdemo.domain.Discuss;
import cn.zptc.springbootdemo.repository.DiscussRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author ：zhaoweiwei
 * @date ：创建于 2025/4/3 13:42
 * @description：
 * @modified By：
 * @version: 1.0.0
 */
@Service
public class DiscussService {

    @Autowired
    private DiscussRepository discussRepository;

    public Discuss add(Discuss discuss){

        return discussRepository.save(discuss);
    }

    public int update(Discuss discuss){

        return discussRepository.updateDiscuss(discuss.getAuthor(),discuss.getId());
    }

    public int delete(Integer id){

        return discussRepository.deleteDiscuss(id);
    }
}
